﻿<UserControl x:Class="SMS.Views.Tracking.TrackingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
             xmlns:my="clr-namespace:SMS.Controls;assembly=SMS.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" 
    d:DesignHeight="300">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Border  BorderBrush="Black" BorderThickness="1">
                <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="35"></RowDefinition>
                <RowDefinition Height="150"/>
                <RowDefinition Height="5"/>
                <RowDefinition/>
            </Grid.RowDefinitions>    
            <StackPanel Orientation="Horizontal" Grid.Row="0" >
                <TextBlock Text="Receipt Number " VerticalAlignment="Center"></TextBlock>
                <TextBox Text="{Binding ReceiptNo, Mode=TwoWay}" Width="150" Margin="2,0,0,2" VerticalAlignment="Center"></TextBox>
                <Button Content="GO" Command="{Binding SearchCommand}" Width="50" Margin="2,0,0,0" Height="26" VerticalAlignment="Center"></Button>
            </StackPanel>
                <Rectangle Style="{StaticResource SeperatorRectangle}" VerticalAlignment="Bottom"></Rectangle>
            <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Text="Customer Name" Visibility="{Binding IsVisible}" ></TextBlock>
            <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding SelectedSaleHistory.Customer.Customer_Name}" FontWeight="Bold" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="1" Grid.Column="0" Text="Total Amount" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding SelectedSaleHistory.TotalSellingPrice}" FontWeight="Bold" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="2" Grid.Column="0" Text="Paid Amount" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SelectedSaleHistory.ActualSelliingPrice}" FontWeight="Bold" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="3" Grid.Column="0" Text="Date" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding SelectedSaleHistory.Selling_Date, Converter={StaticResource OnlyDateConverter}}" FontWeight="Bold" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="4" Grid.Column="0" Text="Discount" Visibility="{Binding IsVisible}"></TextBlock>
            <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding SelectedSaleHistory.Discount}" FontWeight="Bold" Visibility="{Binding IsVisible}"></TextBlock>
        </Grid>
                                                    <sdk:DataGrid AutoGenerateColumns="False" IsReadOnly="True" Grid.Row="3" ItemsSource="{Binding SalesDetailList}" SelectedItem="{Binding SelectedSaleDetail, Mode=TwoWay}" Visibility="{Binding IsVisible}">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn Header="Sr.No." Binding="{Binding SerialNo}"></sdk:DataGridTextColumn>
                <sdk:DataGridTextColumn Header="Product Name" Binding="{Binding ProductName}"></sdk:DataGridTextColumn>
                <sdk:DataGridTextColumn Header="Quantity" Binding="{Binding Quantity}"></sdk:DataGridTextColumn>                    
                <sdk:DataGridTextColumn Header="Unit Price" Binding="{Binding SellingUnitPrice}"></sdk:DataGridTextColumn>
                <sdk:DataGridTextColumn Header="Net Price" Binding="{Binding BilledAmount}"></sdk:DataGridTextColumn>
                <sdk:DataGridTextColumn Header="Total Amount" Binding="{Binding TotalAmount}"></sdk:DataGridTextColumn>
                <sdk:DataGridTextColumn Header="Discount" Binding="{Binding Discount}"></sdk:DataGridTextColumn>                    
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
        </Grid>
            </Border>
            <Grid Grid.Row="1">
                <my:ErrorControl HorizontalAlignment="Left"
                            Name="errorControl1"
                            VerticalAlignment="Top" />
            </Grid>
        </Grid>
        
    </Grid>
</UserControl>
